package com.template;

import java.io.File;
import java.util.ArrayList;
import java.util.List;

import com.template.utils.Utils;

public class TMain {

	/**
	 * @param args
	 */
	public static void main(String[] args) {
		String packageName = "net.thxjj.adminServer";
		String[] pakageArr = packageName.split("\\.");
		String folderName=pakageArr[pakageArr.length-1];
		String schema="th_user";
		String tableName = "th_mobile_user";//fault_bill
		String path = "d:\\work1\\template\\"+packageName;
		File f = new File(path);
		if(!f.exists()) {
			f.mkdirs();
		}
		f = new File(path+"\\action");
		if(!f.exists()) {
			f.mkdirs();
		}
		f = new File(path+"\\dao");
		if(!f.exists()) {
			f.mkdirs();
		}
		f = new File(path+"\\bean");
		if(!f.exists()) {
			f.mkdirs();
		}
		List<TableBean> columnList = new ArrayList<TableBean>();
		List<TableBean> priList = new ArrayList<TableBean>();
		List<TableBean> forList = new ArrayList<TableBean>();
		List<TableBean> noPriList = new ArrayList<TableBean>();
		Utils.parseColumns(schema,tableName,columnList,priList,forList,noPriList);
		TMyBatisMapper.createXMLFile(tableName, packageName, columnList, priList, noPriList, folderName, path);
		TmodelJs.createXMLFile(tableName, packageName, columnList, priList, noPriList, folderName, path);
		THtml.createXMLFile(tableName, packageName, columnList, priList, noPriList, folderName, path);
		TEntity.createXMLFile(tableName, packageName, columnList, priList, noPriList, folderName, path);
	    TDao.createXMLFile(tableName, packageName, columnList, priList, noPriList, folderName, path);
	    TIService.createXMLFile(tableName, packageName, columnList, priList, noPriList, folderName, path);
	    TService.createXMLFile(tableName, packageName, columnList, priList, noPriList, folderName, path);
	    TController.createXMLFile(tableName, packageName, columnList, priList, noPriList, folderName, path);
	}

}
